package com.tarena.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class RegisterServlet implements Servlet{

	public void destroy() {
		
	}

	public ServletConfig getServletConfig() {
		return null;
	}

	public String getServletInfo() {
		return null;
	}

	public void init(ServletConfig arg0) throws ServletException {
		
	}

	public void service(ServletRequest request, ServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=utf-8");
		request.setCharacterEncoding("utf-8");
		PrintWriter out =  response.getWriter();
		out.println("<html>");
		out.println("<head>" +
								"<title>Register...</title>" +
						"</head>");
		
		out.println("<body>");
		out.println("<h1>Register</h1>");
		out.println("<form action='AddUserServlet' method='POST'>");                        
		
		out.println("<table border='1' width='30%'>");
		
		out.println("<tr>");
		out.println("<td>name</td>");
		out.println("<td><input type='text' name='name'/></td>");
		out.println("</tr>");
		
		out.println("<tr>");
		out.println("<td>password</td>");
		out.println("<td><input type='password' name='password'/></td>");
		out.println("</tr>");
		
		out.println("<tr>");
		out.println("<td>email</td>");
		out.println("<td><input type='email' name='email'/></td>");
		out.println("</tr>");
		
		out.println("<tr>");
		out.println("<td>favorite</td>");
		out.println("<td>");
		out.println("C++			<input type='checkbox' name='favorite' value='c++' />");
		out.println("Core Java	<input type='checkbox' name='favorite' value='corejava' />");
		out.println("C# 			<input type='checkbox' name='favorite' value='c#' />");
		out.println("</td>");
		out.println("</tr>");
		
		out.println("</table>");
		
		out.println("<input type='submit' value='确认'>");
		out.println("<input type='reset' 	value='清空'>");
		out.println("</form>");
		out.println("</body>");
		out.println("</html>");
		
	}

}
